package com.wuliu.controller;

import com.wuliu.common.core.controller.BaseController;
import com.wuliu.common.core.domain.ApiResult;
import com.wuliu.common.core.domain.entity.BasCust;
import com.wuliu.common.utils.SecurityUtils;
import com.wuliu.system.domain.BasAdvSet;
import com.wuliu.system.service.IBasAdvSetService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 广告设置Controller
 *
 * @author realue
 * @date 2023-11-09
 */
@Api(tags = {"广告控制器"})
@RestController
@RequiredArgsConstructor
@RequestMapping("/applet/adv")
public class BasAdvSetController extends BaseController {
    private final IBasAdvSetService basAdvSetService;

    /**
     * 查询广告设置列表
     */
    @ApiOperation(value = "查询广告")
    @ApiImplicitParam(name = "position", value = "位置 1.首页 2.其它页", dataType = "integer", paramType = "query")
    @GetMapping("/getList")
    public ApiResult<List<BasAdvSet>> getList(Integer position) {
        BasCust cust = SecurityUtils.getBasCust();
        List<BasAdvSet> list = basAdvSetService.getList(1, position, cust.getSysAccount());
        return ApiResult.success(list);
    }

}
